package com.ebs.md.fxmonitor.marketmonitor.model;

/**
 * Perforce Revision:
 *  $File: //depot/MarketData/fxmonitor/main/src/main/java/com/ebs/md/fxmonitor/marketmonitor/model/PassiveHitSingleFactNML.java $
 *  $Revision: #8 $  $Change: 116131 $  $DateTime: 2012/10/23 12:55:07 $  $Author: Arik.Sher $
 */

import com.ebs.md.api.BookSide;
import com.ebs.md.api.Rate;
import com.ebs.md.api.hit.IHitSubmit;


/**
 * 
 * NML - No Man's Land
 */
public class PassiveHitSingleFactNML
extends AbsSingleFactByTrader
{
	// gened with Eclipse
	private static final long serialVersionUID = -426034643036615565L;

	protected Rate bestRate; // at side of the hit (BID => Sell, OFFER => Buy)
	
	public PassiveHitSingleFactNML(String configInstanceName, IHitSubmit hitSubmit, TOBState tobState)
	{
		super( configInstanceName
			 , tobState.getPair()
			 , hitSubmit.getTime().getTimeInMillis()
			 , hitSubmit.getId()
			 , hitSubmit.getRate()
			 , hitSubmit.getHitSide().getMatchBookSide()
			 , hitSubmit.getDealCode()
			 , hitSubmit.getTraderId()
			 );
		this.quoteRegion = hitSubmit.getRegion();
		this.availAmount = hitSubmit.getAmount();
		this.totalAmount = hitSubmit.getAmount();

		if ( BookSide.BID.equals( hitSubmit.getHitSide().getMatchBookSide() ) ) {
			this.bestRate = tobState.getBestBid();
		} else {
			this.bestRate = tobState.getBestOffer();
		}
	}

	public Rate getBestRate() {
		return bestRate;
	}

	protected String additionalFields4toString() {
		return 
		       super.additionalFields4toString()
			+ ", hitId=" + quoteId
			+ ", bestRate=" + bestRate
			;
	}

}
